![]() ![]() ![]() ![]() |
GUI Changes: The AWT Grows Up |
This section tells you how to write a listener for each kind of event the AWT defines in 1.1. First, it gives an overview of the AWT listeners. After that, each listener type is discussed in its own subsection.In the table that follows, each row describes a particular group of events corresponding to one listener interface. The first column gives the name of the listener interface, with a link to the tutorial page that discusses that listener. The second column names the corresponding adapter class, if any. (For a discussion of using adapters, see the previous section.) The third column lists the methods that the listener interface contains.
To see which AWT 1.1 components can generate which kinds of events, see Events Generated by AWT Components.
Listener Interface Adapter Class Methods ActionListener
none actionPerformed(ActionEvent)
AdjustmentListener
none adjustmentValueChanged(AdjustmentEvent)
ComponentListener
ComponentAdapter
componentHidden(ComponentEvent)
componentMoved(ComponentEvent)
componentResized(ComponentEvent)
componentShown(ComponentEvent)ContainerListener
ContainerAdapter
componentAdded(ContainerEvent)
componentRemoved(ContainerEvent)
FocusListener
FocusAdapter
focusGained(FocusEvent)
focusLost(FocusEvent)
ItemListener
none itemStateChanged(ItemEvent)
KeyListener
KeyAdapter
keyPressed(KeyEvent)
keyReleased(KeyEvent)
keyTyped(KeyEvent)
MouseListener
MouseAdapter
mouseClicked(MouseEvent)
mouseEntered(MouseEvent)
mouseExited(MouseEvent)
mousePressed(MouseEvent)
mouseReleased(MouseEvent)
MouseMotionListener
MouseMotionAdapter
mouseDragged(MouseEvent)
mouseMoved(MouseEvent)
TextListener
none textValueChanged(TextEvent)
WindowListener
WindowAdapter
windowActivated(WindowEvent)
windowClosed(WindowEvent)
windowClosing(WindowEvent)
windowDeactivated(WindowEvent)
windowDeiconified(WindowEvent)
windowIconified(WindowEvent)
windowOpened(WindowEvent)
![]() ![]() ![]() ![]() |
GUI Changes: The AWT Grows Up |